# 基础镜像
FROM golang as builder
# 作者
MAINTAINER duduup "duduup@aliyun.com"
#工作目录
WORKDIR /go/src/github.com/cnlh/nps
# copy项目到容器
COPY . .

RUN go get -d -v ./...
RUN CGO_ENABLED=0 go build -ldflags="-w -s -extldflags -static" ./cmd/nps/nps.go

FROM scratch
COPY --from=builder /go/src/github.com/cnlh/nps/nps /
COPY --from=builder /go/src/github.com/cnlh/nps/web /web
VOLUME /conf
CMD ["/nps"]
